/**
 * Created with CLion.
 * Description: 
 * User: loong
 * Date: 2020-09-08
 * Time: 23:35
 */
#include <iostream>
#include <functional>

using namespace std;


int main()
{
    
    int offset = 42;      // 1
    std::function<int(int)> offset_a = [&](int j)
    { return offset + j; };      // 2
    offset = 123;         // 3
    std::function<int(int)> offset_b = [&](int j)
    { return offset + j; };      // 4
    std::cout << offset_a(12) << "," << offset_b(12) << std::endl;              // 5
    offset = 99;          // 6
    std::cout << offset_a(12) << "," << offset_b(12) << std::endl;              // 7
    return 0;
}